package com.wxzz.elearing.pay.api.server;

import com.wxzz.elearing.pay.service.IUserOrderService;
import com.wxzz.elearning.common.dto.ActivityStatisticsDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

@RestController
@RequestMapping("/user-order-api")
public class UserOrderApi {

    @Autowired
    private IUserOrderService userOrderService;

    /**
     * 统计活动收入
     *
     * @param platformLivetelecastId
     * @param onlineType
     * @return
     */
    @RequestMapping(value = "/selectCountAmount/{platformLivetelecastId}/{onlineType}", method = RequestMethod.POST)
    public BigDecimal selectCountAmount(@PathVariable Long platformLivetelecastId, @PathVariable Integer onlineType) {
        return userOrderService.selectCountAmount(platformLivetelecastId, onlineType);
    }

    /**
     * 查看活动统计数据
     * @param activityId
     * @return
     */
    @RequestMapping(value = "/selectActivityStatisticsDto/{activityId}", method = RequestMethod.POST)
    public List<ActivityStatisticsDto> selectActivityStatisticsDto(@PathVariable Long activityId) {
        return userOrderService.selectActivityStatisticsDto(activityId);
    }
}
